<template>
  <div class="user-page">
    <div class="user-page-left">
      <div class="user-page-title">
        用户中心
      </div>

      <div class="user-page-cell" :class="{ 'is-active': active === 1 }" @click="onChange(1)">
        个人资料
      </div>

      <div class="user-page-cell" :class="{ 'is-active': active === 2 }" @click="onChange(2)">
        我的日接待汇总表
      </div>

      <div class="user-page-cell" :class="{ 'is-active': active === 3 }" @click="onChange(3)">
        我的店铺
      </div>

      <div class="user-page-cell" :class="{ 'is-active': active === 4 }" @click="onChange(4)">
        我的服务数据
      </div>

      <div class="user-page-cell" :class="{ 'is-active': active === 5 }" @click="onChange(5)">
        我的提成核对表
      </div>
    </div>

    <div class="user-page-right">
      <UserInfo v-if="active === 1" />
      <PeceptionPage v-if="active === 2" />
      <ShopPage v-if="active === 3" />
      <ServicePage v-if="active === 4" />
      <CommissionPage v-if="active === 5" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import UserInfo from './components/UserInfo.vue'
import peceptionPage from './components/peceptionPage'
import shopPage from './components/shopPage'
import servicePage from './components/servicePage'
import commissionPage from './components/commissionPage'

const PeceptionPage = peceptionPage.getComponent()
const ShopPage = shopPage.getComponent()
const ServicePage = servicePage.getComponent()
const CommissionPage = commissionPage.getComponent()

const active = ref(1)

const onChange = val => {
  active.value = val
}
</script>

<style scoped lang="scss">
.user-page {
  height: calc(100vh - 280px);
  margin: 45px 80px 0;
  background: #FFFFFF;
  padding: 45px;
  padding-right: 0;
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  &-left {
    flex-shrink: 0;
    width: 190px;
    height: 100%;
    background: #181717;
    box-shadow: 3px 6px 27px 0 #00000033;
    border-radius: 6px;
  }
  &-title {
    font-family: PingFangSC-Medium;
    font-weight: 500;
    font-size: 15px;
    color: #FFFFFF;
    padding-top: 29px;
    margin: 0 0 46px 20px;
  }
  &-cell {
    font-family: PingFangSC-Regular;
    font-weight: 400;
    font-size: 14px;
    color: #999999;
    width: 170px;
    height: 42px;
    border-radius: 4px;
    margin: 10px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding-left: 25px;
    cursor: pointer;
    &.is-active {
      background: #094DB2;
      color: #FFFFFF;
    }
  }

  &-right {
    flex-grow: 1;
    width: calc(100% - 190px);
    box-sizing: border-box;
  }
}
</style>
